﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;

namespace HandLab.WebApp.RadControls
{
    public partial class Test1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void RadTreeView1_NodeDrop(object sender, Telerik.Web.UI.RadTreeNodeDragDropEventArgs e)
        {
            foreach (RadTreeNode node in e.DraggedNodes)
            {
                e.DestDragNode.Nodes.Add(node);
            }

        }

        protected void RadTreeView1_ContextMenuItemClick(object sender, RadTreeViewContextMenuEventArgs e)
        {
            switch (e.MenuItem.Value)
            {
                case "1":
                    if (e.Node.Level == 0)
                    {
                        e.Node.Nodes.Add(new RadTreeNode("New " + e.Node.Text + " " + DateTime.Now.ToString()));
                        e.Node.Expanded = true;
                    }
                    break;
                case "2":
                    
                    break;  
                case "3":
                    if (e.Node.Level == 1)
                    {
                        e.Node.Remove();
                    }
                    break;
            }

        }

        protected void RadTreeView1_NodeClick(object sender, RadTreeNodeEventArgs e)
        {
            //this.Response.Redirect("ContextMenu.aspx");
        }
    }
}